<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/token.jsp"%>
<%!
	String delete(Token token, Input input) {
		Message msg = new Message(0);
		String commentId = input.getDesc("id", "");
		Integer uid = token.getUid();
		List list = QBuilder.db("basedb").select().from("Comment").where(new Where("id=", commentId).and("uid=", uid).and("status=", STATUS_ENABLE).and("category=", 1)).query().getResultObj();
		if(isEmpty(list)) {
			msg = new Message(30041, "评论不存在");
			return msg.toJson();
		}
		Integer id = QBuilder.db("basedb").execHQL("update Comment set status = 0 where id =  " + commentId);
		if (isEmpty(id))
			msg = new Message(30041, "删除评论失败了");
		return msg.toJson();
	}
%>
<%
	Tools.encryptPrint(out, delete(token, input));
%>
